<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../../js/vue.js"></script>
</head>
<template id="cpn_id">
    <div>
        <h2>{{title}}</h2>
    </div>
</template>
<body>
<div id="div_id">
    <cpn></cpn>
</div>
<script>
    Vue.component("cpn",{
        template:"#cpn_id",
        //每个组件自带data,methods，且必须是方法，而不是属性
        data(){
            return{
                title:"我是标题"
            }
        }
    });
    const app=new Vue({
       el:"#div_id"
    });
</script>
</body>
</html>